<template>
  <div class="content_box">
    
    <img mode="widthFix" class="bj" src="https://yxzw.oss-cn-chengdu.aliyuncs.com/rich/20230115/20231212151617.png" alt="">
    <div class="nr_box">
      <p class="title">全五星好评+晒图返<span>25元立减券</span></p>
      <p class="price">￥<span>25</span></p>
      <div class="t_text">
        <p>1.根据规则上传美团/抖音好评截图，等待系统审核</p>
        <p>2.一个工作日内审核通过后可获得25元无门槛立减券</p>
        <p>3.此活动仅限团购用户参与</p>
      </div>
      <div class="t_text" style="margin-top:200rpx">
        <p>1.评价至少上传3张图片</p>
        <p>2.评价内容20字以上，鼓励参考性评论，如环境如何、体验如何、麻将手感及整体感受如何等</p>
      </div>
      <div class="anniu" @click="toFormData">
        去上传好评
      </div>
    </div>
  </div>
</template>

<script>
import { 
  getToken,
  getUserPhone
} from "@/utils/auth";
export default {
  data() {
    return {
    };
  },
  methods: {

    // 去写好评
    toFormData(){
      let that = this
      if(!getUserPhone()){
        wx.navigateTo({
          url: '/pages/authorization/main',
        });
        return
      }
      wx.navigateTo({
              url: `/pages/pinglun/formData/main`,
            });
      // wx.requestSubscribeMessage({
      //   tmplIds: ['-o0mEfHqRxGyUct2L8Ewh047-oxxX3x56lh9VenqLd0','zmxYAeleG6MXlQ14TjDLn-1KMnJPZkZK2PdsEkJT0aE'],
      //   success: (res) => {
      //     //console.log(res);
      //     if(res["-o0mEfHqRxGyUct2L8Ewh047-oxxX3x56lh9VenqLd0"] == 'accept' && res["zmxYAeleG6MXlQ14TjDLn-1KMnJPZkZK2PdsEkJT0aE"] == 'accept'){
           
      //     }else{
      //       that.guideOpenSubscribeMessage();
      //     }
          
      //   },
      //   fail: (res) => {
      //       //console.log(res)
      //       if (res.errCode == 20004) {
      //           that.guideOpenSubscribeMessage();
      //       }
      //       //console.log("取消")
      //   },
      //   complete: (errMsg) => {
      //       //console.log("订阅消息 完成 " + errMsg); 
      //   }
      // })
    },

    // guideOpenSubscribeMessage() {    
    //   var that = this;
    //   wx.showModal({         
    //     title: '提示',
    //     content: '检测到您没有开启订阅消息的权限，是否去设置？',
    //     success: function (sm) {
    //       if (sm.confirm) {// 用户点击了确定 可以调用删除方法了            
    //           wx.openSetting();
    //       } else if (sm.cancel) { 
    //           wx.showToast({
    //               title: '必须要授权订阅消息才能好评返现！',
    //               icon: 'none'
    //           }); 
    //       }
    //     }
    //   })    
    // },
  },
  onShow(){
    if(!getToken()){
      wx.login({
        success:(res)=>{
          let code = res.code
          this.$store.dispatch("userLogin", code).then(res=>{
            if(res.statusCode == '00000'){
            }
          })
        }
      })
    }
  },
  onLoad(options) {
    //console.log(options)
    //判断手机机型，动态给底部添加样式
    wx.getSystemInfo({
      success: (res) => {
        //console.log("手机信息res" + res.model);
        let modelmes = res.model;
        if (
          modelmes.search("iPhone 14") != -1 ||
          modelmes.search("iPhone 13") != -1 ||
          modelmes.search("iPhone 12") != -1 ||
          modelmes.search("iPhone 11") != -1 ||
          modelmes.search("iPhone X") != -1 ||
          modelmes.search("iPhone XR") != -1 ||
          modelmes.search("iPhone XS") != -1
        ) {
          this.isIphoneXnum = 25;
        } else {
          this.isIphoneXnum = 10;
        }
      },
    });
  },
};
</script>

<style lang="scss" scoped>
/* 去除button默认样式 */

  button::after {
   border: none;
  }

  button {
    background-color: transparent;
    padding-left: 0;
    padding-right: 0;
    line-height:inherit;
  }
  button {
  border-radius:0;
}
.content_box {
  position: relative;
  .bj{
    width: 100%;
  }
  .nr_box{
    width: 100%;
    position: absolute;
    top:0;
    .title{
      text-align: center;
      color:#00C200;
      font-size:34rpx;
      font-weight: 500;
      margin-top:270rpx;
      span{
        color:#FE6706;
      }
    }
    .price{
      text-align: center;
      font-weight: 600;
      font-size:40rpx;
      color:#A75C2A;
      margin-top:90rpx;
      position: relative;
      top:-10rpx;
      span{
        font-size:80rpx;
      }
    }
    .t_text{
      width: 76%;
      margin:0 auto;
      color:#333333;
      font-size:24rpx;
      margin-top:284rpx;
      line-height: 40rpx;
    }
  }
  
  .anniu{
    width: 686rpx;
    height: 96rpx;
    line-height: 96rpx;
    background: #00C200;
    box-shadow: 0rpx 12rpx 32rpx 0rpx rgba(0,194,0,0.3);
    border-radius: 44rpx;
    text-align: center;
    font-size: 36rpx;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #FFFFFF;
    margin:110rpx auto 0 auto;
    &.on_anniu{
      background: rgba(0,194,0,0.3);
      box-shadow: 0rpx 12rpx 32rpx 0rpx rgba(0,194,0,0.25);
    }
  }
}

</style>